package com.cskaoyan.service;

import com.cskaoyan.bean.MarketFeedback;
import com.cskaoyan.bean.MarketUser;
import com.cskaoyan.mapper.MarketFeedbackMapper;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class FeedbackServiceImpl implements FeedbackService {

    @Autowired
    MarketFeedbackMapper marketFeedbackMapper;

    @Override
    public void insertFeedback(MarketFeedback marketFeedback) {
        //获取ID
        Subject subject = SecurityUtils.getSubject();
        MarketUser primaryPrincipal = (MarketUser) subject.getPrincipals().getPrimaryPrincipal();
        Integer uid = primaryPrincipal.getId();

        marketFeedback.setUserId(uid);
        marketFeedbackMapper.insertSelective(marketFeedback);
    }


}
